package com.smalls.redshoes.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.GridView;

import java.util.Map;

public class ViewPagerAdapter extends PagerAdapter {
    private Map<Integer, GridView> map;

    public Map<Integer, GridView> getMap() {
        return this.map;
    }

    public void setMap(Map<Integer, GridView> map) {
        this.map = map;
    }

    public ViewPagerAdapter(Context context, Map<Integer, GridView> map) {
        this.map = map;
    }

    public int getCount() {
        return this.map.size();
    }

    public boolean isViewFromObject(View arg0, Object arg1) {
        return arg0 == arg1;
    }

    public Object instantiateItem(View arg0, int arg1) {
        ((ViewPager) arg0).addView((View) this.map.get(Integer.valueOf(arg1)));
        return this.map.get(Integer.valueOf(arg1));
    }

    public void destroyItem(View arg0, int arg1, Object arg2) {
        ((ViewPager) arg0).removeView((View) arg2);
    }
}
